const useAgentOwnPointColumn = (newFormat: any) => {
	const customRender = (value: any) => {
		if (isNaN(value) || value === null || value === undefined) {
			return "-"
		}
		return value + "%"
	}

	const header = (label: string) => {
		return (
			<div>
				{newFormat(label)} <br /> {newFormat("funds.proxy_member_funds_record.person_rebate_proportion")}
			</div>
		)
	}

	const userName = {
		dataIndex: "userName",
		title: newFormat("funds.fund_audit.account_number"),
		width: 120,
		align: "center",
		render: (_text: string, record: any) => <span>{record.userName}</span>
	}

	const texasRebate = {
		dataIndex: "texasRebate",
		title: header("common.dxn_club"),
		width: 200,
		align: "center",
		render: (_text: string, record: any) => <span>{customRender(record.texasRebate)}</span>
	}

	const texasInsuranceRebate = {
		dataIndex: "texasInsuranceRebate",
		title: header("common.dxn_insurance"),
		width: 200,
		align: "center",
		render: (_text: string, record: any) => <span>{customRender(record.texasInsuranceRebate)}</span>
	}

	const actualPersonRebate = {
		dataIndex: "actualPersonRebate",
		title: header("common.game_video"),
		width: 200,
		align: "center",
		render: (_text: string, record: any) => <span>{customRender(record.actualPersonRebate)}</span>
	}

	const sportsRebate = {
		dataIndex: "sportsRebate",
		title: header("common.game_sports"),
		width: 200,
		align: "center",
		render: (_text: string, record: any) => <span>{customRender(record.actualPersonRebate)}</span>
	}

	const lotteryTicketRebate = {
		dataIndex: "lotteryTicketRebate",
		title: header("common.game_lottery"),
		align: "center",
		width: 200,
		render: (_text: string, record: any) => <span>{customRender(record.lotteryTicketRebate)}</span>
	}

	const chessRebate = {
		dataIndex: "chessRebate",
		title: header("common.game_poker"),
		width: 200,
		align: "center",
		render: (_text: string, record: any) => <span>{customRender(record.chessRebate)}</span>
	}

	const esportsRebate = {
		dataIndex: "esportsRebate",
		title: header("common.game_e_sports"),
		width: 200,
		align: "center",
		render: (_text: string, record: any) => <span>{customRender(record.chessRebate)}</span>
	}

	return {
		userName,
		texasRebate,
		texasInsuranceRebate,
		actualPersonRebate,
		sportsRebate,
		chessRebate,
		lotteryTicketRebate,
		esportsRebate
	}
}

export default useAgentOwnPointColumn
